<%include pub/admin_head.html%>
    </head>
    <body>
        <!-- Page Container -->
        <div class="page-container">
            <%include pub/admin_nav.html%>
            <!-- Page Content -->
            <div class="page-content">
                <div class="page-inner">
                	<div class="page-title">
                        <h3 class="breadcrumb-header">所有教师列表</h3>
                    </div>
                    <div id="main-wrapper">
                        <div class="col-md-12">
                            <table class="table" style="margin-top: 10px;">
                                <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>教师账号</th>
                                        <th>教师昵称</th>
                                        <th>最大班级数</th>
                                        <th>最大班级学生数</th>
                                        <th>所在学校</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <%for(let i=0; i< data.length;i++){%>
                                    <tr>
                                        <th scope="row"><%= i+1 %></th>
                                        <td><%= data[i].username %></td>
                                        <td><%= data[i].nickname %></td>
                                        <td><%= data[i].classNum %></td>
                                        <td><%= data[i].stuNum %></td>
                                        <td><strong><%= data[i].school.names %></strong></td>
                                        <td>
                                            <button type="button" class="btn btn-primary btn-sm changebase-tch" tid="<%- data[i]._id %>" tname="<%= data[i].nickname %>" tclass="<%= data[i].classNum %>" tstu="<%= data[i].stuNum %>">修改基本信息</button>
                                        	<button type="button" class="btn btn-primary btn-sm changepwd-tch" tid="<%- data[i]._id %>">修改密码</button>
                                            <%if(data[i].school){%>
                                            <button type="button" class="btn btn-success btn-sm c-school-tch" tid="<%- data[i]._id %>">修改所在学校</button>
                                            <%}else{%>
                                            <button type="button" class="btn btn-success btn-sm c-school-tch" tid="<%- data[i]._id %>">加入学校</button>
                                            <%}%>

                                        	<%if(data[i].status == 0){%>
	                                        <button type="button" class="btn btn-danger btn-sm delete-tch" tid="<%- data[i]._id %>">封号</button>
	                                        <%}else{%>
	                                        <button type="button" class="btn btn-success btn-sm jf-tch" tid="<%- data[i]._id %>">解封</button>
	                                        <%}%>
	                                    </td>
                                    </tr>
                                	<%}%>	
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal fade bs-example-modal-sm" id="changeBaseTchModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-sm">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="mySmallModalLabel">修改教师信息 <br>(修改后请通知教师重新登录账号)</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <label>教师昵称</label>
                            <input type="text" class="form-control" id="tch-nickname" />
                        </div>
                        <div class="form-group">
                            <label>最大班级数</label>
                            <input type="number" min="1" class="form-control" id="tch-classnum" />
                        </div>
                        <div class="form-group">
                            <label>最大班级学生数</label>
                            <input type="number" min="1" class="form-control" id="tch-stunum" />
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-success tch_changebase">确认</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal fade bs-example-modal-sm" id="changeSchoolTchModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-sm">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="mySmallModalLabel">教师所在学校 <br>(修改后请通知教师重新登录账号)</h4>
                    </div>
                    <div class="modal-body">
                        <%if(school.length > 0){%>
                        <div class="form-group">
                            <label>请先选择教师所在学校</label>
                            <select class="form-control" id="school-tch">
                                <%for(let i = 0; i < school.length; i++){%>
                                <option value="<%= school[i]._id%>"><%= school[i].names%></option>
                                <%}%>
                            </select>
                        </div>
                        <%}else{%>
                        请先添加学校，<a href="/admin/schoollist" style="text-decoration: underline;">前往添加</a>
                        <%}%>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-success tch_changeschool">确认</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal fade bs-example-modal-sm" id="changeTchModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-sm">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="mySmallModalLabel">修改教师密码</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <label>新密码</label>
                            <input type="text" class="form-control" id="tch-password" />
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-success tch_changepwd">确认</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- Javascripts -->
        <%include pub/admin_foot.html%>
    </body>
</html>